<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>智能对话助手</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .chat-container {
            height: 70vh;
            overflow-y: auto;
            margin-bottom: 20px;
            background: white;
            border-radius: 8px;
            padding: 15px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .message {
            margin-bottom: 15px;
            padding: 10px 15px;
            border-radius: 18px;
            max-width: 80%;
            word-wrap: break-word;
        }
        .user-message {
            background-color: #e3f2fd;
            margin-left: auto;
            border-bottom-right-radius: 4px;
        }
        .assistant-message {
            background-color: #f1f1f1;
            margin-right: auto;
            border-bottom-left-radius: 4px;
        }
        .input-area {
            display: flex;
            gap: 10px;
        }
        #user-input {
            flex-grow: 1;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 20px;
            outline: none;
        }
        #send-button {
            padding: 12px 20px;
            background-color: #4285f4;
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
        }
        #send-button:hover {
            background-color: #3367d6;
        }
        .typing-indicator {
            display: inline-block;
            padding: 10px 15px;
            background-color: #f1f1f1;
            border-radius: 18px;
            margin-bottom: 15px;
        }
        .dot {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #666;
            margin: 0 2px;
            animation: bounce 1.4s infinite ease-in-out;
        }
        .dot:nth-child(2) {
            animation-delay: 0.2s;
        }
        .dot:nth-child(3) {
            animation-delay: 0.4s;
        }
        @keyframes bounce {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-5px); }
        }
        .history-sidebar {
            position: fixed;
            left: 0;
            top: 0;
            width: 250px;
            height: 100vh;
            background: white;
            box-shadow: 2px 0 5px rgba(0,0,0,0.1);
            padding: 20px;
            overflow-y: auto;
            transform: translateX(-100%);
            transition: transform 0.3s ease;
            z-index: 100;
        }
        .history-sidebar.visible {
            transform: translateX(0);
        }
        .history-item {
            padding: 10px;
            margin-bottom: 10px;
            border-radius: 4px;
            cursor: pointer;
            background: #f9f9f9;
        }
        .history-item:hover {
            background: #eee;
        }
        .toggle-history {
            position: fixed;
            left: 20px;
            top: 20px;
            background: #4285f4;
            color: white;
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            cursor: pointer;
            z-index: 99;
        }
    </style>
</head>
<body>
<button class="toggle-history" onclick="toggleHistory()">≡</button>

<div class="history-sidebar" id="history-sidebar">
    <h3>历史对话</h3>
    <button style="padding-bottom: 5px; margin: 10px " onclick="toggleHistory()">收缩</button>
    <div id="history-list"></div>
</div>
<button style="
            margin-bottom: 10px;
            padding: 12px 20px;
            background-color: #4285f4;
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;" onclick="startNewConversation()">开启新话题</button>
<div class="chat-container" id="chat-container">
    <!-- 对话内容将在这里动态生成 -->
</div>

<div class="input-area">
    <input type="text" id="user-input" placeholder="输入你的问题..." autocomplete="off">
    <button id="send-button" onclick="sendMessage()">发送</button>
</div>

<script type="text/javascript" src="script/index.js"></script>

</body>
</html>